/**
 * 
 */
package com.${ltdAbbr}.xiao.${module}.task.web.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.${ltdAbbr}.xiao.${module}.task.po.LoginBo;
import com.${ltdAbbr}.xiao.${module}.task.web.interceptor.LoginCheckInterceptor;


/**
 * @author admin
 *
 */
@Controller
@RequestMapping("/site")
public class LoginController {

    /**
     * 登录页面
     * @return
     */
    @RequestMapping(path="/login.action", method=RequestMethod.GET)
    public ModelAndView loginGet() {
        return new ModelAndView("tpl/login");
    }

    /**
     * 登录操作
     * @return
     */
    @ResponseBody
    @RequestMapping(path="/login.action", method=RequestMethod.POST)
    public int loginPost(HttpServletRequest req, LoginBo loginBo) {
        req.getSession().setAttribute(LoginCheckInterceptor.SESSION_KEY, loginBo.getUsername()==null?1:loginBo.getUsername());
        return 1;
    }
}
